package com.xiaomuwu.android.ui.home

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel
import com.xiaomuwu.android.logic.Repository
import com.xiaomuwu.android.logic.model.ForRes
import com.xiaomuwu.android.logic.model.Res

class ResViewModel:ViewModel() {

    private val toResLiveData=MutableLiveData<ForRes>()

//    private val toReleResLiveData=MutableLiveData<ForReleRes>()

    val resList=ArrayList<Res>()

//    val releResList=ArrayList<Res>()

    var resLiveData=Transformations.switchMap(toResLiveData){forRes->
        Repository.getRes(forRes)
    }

//    var releResLiveData= Transformations.switchMap(toReleResLiveData){ forReleRes->
//        Repository.getReleRes(forReleRes)
//    }

    fun getResLiveData(forRes: ForRes){
        toResLiveData.value=forRes
    }

//    fun getReleResLiveData(forReleRes:ForReleRes){
//        toReleResLiveData.value=forReleRes
//    }

}